﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ListCategory.ascx.cs" Inherits="Controls_ListCategory" %>

<script type="text/javascript">

    function confirmation(categoryID) {
        var err = "<%=deletecf%>";
        var answer = confirm(err);
        if (answer) {
            window.location = "Delete.aspx?categoryid=" + categoryID;
        }
    }
</script>
<asp:ScriptManager ID="ScriptManager1" runat=server EnablePageMethods=true />
<%if (listCategory.Count > 0) { %>
<table class="TableCategories" id="tablepaging">
    <thead>
        <th><%=Language["ID"] %></th>
        <th style="width: 300px"><%=Language["Name"] %></th>
        <%if (isDisplayItem == true)
           {%>
        <th><%=Language["Items"]%></th>
        <% } %>
        <th></th>
    </thead>
    <tbody>
        <% for (int i = 0; i < listCategory.Count; i = i + 1)
           { %>
        <tr class="Even">
            <td class="Center"><%= listCategory[i].ID %></td>
            <% if (isDisplayItem == true)
               {%>
            <td><a href="../Home/ListBooks.aspx?catelogyid=<%=listCategory[i].ID%>"><%= listCategory[i].Name %></a></td>
            <td><%= listCategory[i].Items %></td>
            <% }
            else{ %>
            <td><%= listCategory[i].Name %></td>
            <% } %>
            <td class="Center"><a href="../Home/Categories.aspx?categoryid=<%=listCategory[i].ID%>">
                                   <img src="../Images/TextEdit.png" alt="Edit" width="25px" title="Edit"/>
                               </a> 
                <a style="padding-left:35px; " href="#" onclick="confirmation(<%=listCategory[i].ID%>)">
                    <img src="../Images/DeleteRed.png" alt="Edit" width="25px" title="Delete"/>
                </a>
            </td>
        </tr>
        <%} %>
    </tbody>
</table>
<%if (listCategory.Count > 20) { %>
<div id="pageNavPosition" style="padding-top: 20px; text-align:left; float: left; width: 100%;" align="center"></div>
 <script type="text/javascript">

     var pager = new Pager('tablepaging', 20);
     pager.init();
     pager.showPageNav('pager', 'pageNavPosition');
     pager.showPage(1);  

</script>
<%} %>
<%}else{ %>
         <p class="NoResult">
             <%=Language["noresult"] %>
         </p>
<%} %>